package com.example.zbh.dsliao.ui.activty;

import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.TextView;

import com.easemob.chat.EMChatManager;
import com.easemob.chat.EMChatRoom;
import com.example.zbh.dsliao.R;
import com.example.zbh.dsliao.ui.adapter.ChatRoomAdapter;

import java.util.List;

/**
 * Created by zbh on 15/12/1.
 */
public class ChatRoomActivity extends BaseActivity implements View.OnClickListener {
    private LinearLayout back;
    private ListView conversartionlistView;
    private List<EMChatRoom> roomList;
    private ChatRoomAdapter chatRoomAdapter;
    private TextView add_list_friends;


    @Override
    protected int getLayOut() {
        return R.layout.fragment_conversartionlist;
    }

    @Override
    protected void initView() {
        back = findeView(R.id.back);
        conversartionlistView = findeView(R.id.conversartionlistView);
        add_list_friends = (TextView) findViewById(R.id.add_list_friends);



    }

    @Override
    protected void initData() {
        back.setOnClickListener(this);
        add_list_friends.setText("聊天室");
        roomList = EMChatManager.getInstance().getAllChatRooms();
        Log.i("nannannan", roomList.size() + "");
        chatRoomAdapter = new ChatRoomAdapter();
        conversartionlistView.setAdapter(chatRoomAdapter);
        chatRoomAdapter.addData(roomList);





    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.back:
                finish();
                break;

        }
    }
}
